﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace DCS.Business.Model
{
    /// <summary>
    /// PRLMessage
    /// </summary>
    public class PRLMessage : ICloneable
    {
        #region ctor.

        /// <summary>
        /// PRLMessage 构造函数
        /// </summary>
        public PRLMessage()
        { }

        /// <summary>
        /// PRLMessage OR映射构造函数
        /// </summary>
        public PRLMessage(System.Data.IDataReader dr)
        {
            this.MessageId = (Guid)dr["MessageId"];
            this.Carrier = Convert.ToString(dr["Carrier"]);
            this.FlightNo = Convert.ToString(dr["FlightNo"]);
            this.PDate = Convert.ToDateTime(dr["PDate"]);
            this.DeptAirport = Convert.ToString(dr["DeptAirport"]);
            this.ArrAirport = Convert.ToString(dr["ArrAirport"]);
            this.CabinNo = Convert.ToString(dr["CabinNo"]);
            this.PName = Convert.ToString(dr["PName"]);
            this.PNR = Convert.ToString(dr["PNR"]);
            this.Seat = Convert.ToString(dr["Seat"]);
            this.BN = Convert.ToString(dr["BN"]);
            this.GATE = Convert.ToString(dr["GATE"]);
            this.WK = Convert.ToString(dr["WK"]);
            this.Package = Convert.ToString(dr["Package"]);
            this.ShareCode = Convert.ToString(dr["ShareCode"]);
            this.FQTV = Convert.ToString(dr["FQTV"]);
            this.FQTR = Convert.ToString(dr["FQTR"]);
            this.FQTS = Convert.ToString(dr["FQTS"]);
            this.HC = Convert.ToString(dr["HC"]);
            this.TKNE = Convert.ToString(dr["TKNE"]);
            this.FOID = Convert.ToString(dr["FOID"]);
            this.PSPT = Convert.ToString(dr["PSPT"]);
            this.CNIN = Convert.ToString(dr["CNIN"]);
            this.CKIN = Convert.ToString(dr["CKIN"]);
            this.PSM = Regex.Replace(Convert.ToString(dr["PSM"]), "[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]", "*");
            this.SPML = (SPMLType)Convert.ToInt32(dr["SPML"]);
            this.SSR = (SSRType)Convert.ToInt32(dr["SSR"]);
            this.IsVip = Convert.ToBoolean(dr["IsVip"]);
            this.RefFileId = Convert.ToInt32(dr["RefFileId"]);
        }

        #endregion

        #region Properities

        /// <summary>
        /// PRL消息唯一标识
        /// </summary>
        public Guid MessageId { get; set; }

        /// <summary>
        /// 承运人
        /// </summary>
        public string Carrier { get; set; }

        /// <summary>
        /// 航班号
        /// </summary>
        public string FlightNo { get; set; }

        /// <summary>
        /// 航班日期
        /// </summary>
        public DateTime PDate { get; set; }

        /// <summary>
        /// 起飞站
        /// </summary>
        public string DeptAirport { get; set; }

        /// <summary>
        /// 到达站
        /// </summary>
        public string ArrAirport { get; set; }

        /// <summary>
        /// 舱位信息，如DTW004J
        /// </summary>
        public string CabinNo { get; set; }

        /// <summary>
        /// 旅客姓名
        /// </summary>
        public string PName { get; set; }

        /// <summary>
        /// 旅客PNR
        /// </summary>
        public string PNR { get; set; }

        /// <summary>
        /// 座位号
        /// </summary>
        public string Seat { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string BN { get; set; }

        /// <summary>
        /// 登机口
        /// </summary>
        public string GATE { get; set; }

        /// <summary>
        /// 行李件数/重量
        /// </summary>
        public string WK { get; set; }

        /// <summary>
        /// 行李条信息，包括行李号，目的地城市
        /// </summary>
        public string Package { get; set; }

        /// <summary>
        /// 共享代码数据，即.M/
        /// </summary>
        public string ShareCode { get; set; }

        /// <summary>
        /// 联程航班数据，即.O/
        /// </summary>
        public string OutBound { get; set; }

        /// <summary>
        /// 常旅客信息
        /// </summary>
        public string FQTV { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string FQTR { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string FQTS { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string FQTU { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string HC { get; set; }

        /// <summary>
        /// 电子票号
        /// </summary>
        public string TKNE { get; set; }

        /// <summary>
        /// 旅客身份信息（身份证号）
        /// </summary>
        public string FOID { get; set; }

        /// <summary>
        /// 护照信息
        /// </summary>
        public string PSPT { get; set; }

        /// <summary>
        /// CNIN信息
        /// </summary>
        public string CNIN { get; set; }

        /// <summary>
        /// CKIN信息
        /// </summary>
        public string CKIN { get; set; }

        /// <summary>
        /// 旅客服务信息
        /// </summary>
        public string PSM { get; set; }

        /// <summary>
        /// 特殊餐食
        /// </summary>
        public SPMLType SPML { get; set; }

        /// <summary>
        /// 特殊服务
        /// </summary>
        public SSRType SSR { get; set; }

        /// <summary>
        /// 是否为VIP
        /// </summary>
        public bool IsVip { get; set; }

        /// <summary>
        /// 所对应的DCS文件Id
        /// </summary>
        public int RefFileId { get; set; }

        #endregion

        #region ICloneable Members

        public object Clone()
        {
            return this.MemberwiseClone();
        }

        #endregion
    }
}
